package com.carl.zlds.tool.util;

import com.carl.zlds.tool.exception.GlobalException;

public class AssertUtil {
    public AssertUtil() {
    }

    public static void isNull(String message, Object bean) {
        if (bean == null) {
            exception(1004, message);
        }

    }

    public static void isNull(Integer type, String message, Object bean) {
        if (bean == null) {
            exception(type, message);
        }

    }

    public static void isNotNull(String message, Object bean) {
        if (bean != null) {
            exception(1005, message);
        }

    }

    public static void isNotNull(Integer type, String message, Object bean) {
        if (bean != null) {
            exception(type, message);
        }

    }

    public static void exception(String message) {
        throw new GlobalException(message);
    }

    public static void exception(Integer type, String message) {
        throw new GlobalException(type, message);
    }
}
